package com.androidwwf.jwr;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainScreenActivity extends Activity {
    

	private Button bnews, bMediaWWF, bgame, babout, bPlayerData, bBrowser;
	
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mainscreen);        
        init();
    }
    
    private void init()
    {
    	bnews = (Button) findViewById(R.id.bNews);
    	bnews.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				Intent choosegame = new Intent("com.androidwwf.jwr.ANDROIDRSSREADER");
				startActivity(choosegame);
			}
		});
    	
    	bMediaWWF = (Button) findViewById(R.id.bMediaWWF);
    	bMediaWWF.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				Intent choosegame = new Intent("com.androidwwf.jwr.IMAGESGRIDVIEWACTIVITY");
				startActivity(choosegame);
			}
		});
    	
    	bgame = (Button) findViewById(R.id.bGames);
    	bgame.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
//				Intent choosegame = new Intent("com.androidwwf.jwr.CHOOSEGAMEACTIVITY");
//				startActivity(choosegame);
				
				
				AlertDialog.Builder builder = new AlertDialog.Builder(MainScreenActivity.this);
				builder.setMessage("Which game do you want to play?")
				       .setPositiveButton("Compare pictures game", new DialogInterface.OnClickListener() {
				           public void onClick(DialogInterface dialog, int id) {
				        	   Intent gameRandomPicture = new Intent("com.androidwwf.jwr.GAMERANDOMPICTUREMAINSCREENACTIVITY");
							   startActivity(gameRandomPicture);
				           }
				       })
				       .setNegativeButton("Quiz game", new DialogInterface.OnClickListener() {
				           public void onClick(DialogInterface dialog, int id) {
				        	   Intent gamequiz = new Intent("com.androidwwf.jwr.GAMEQUIZ");
							   startActivity(gamequiz);
				           }
				       });
				
				AlertDialog alert = builder.create();
				alert.show();
	
			}
		});
    	
    	babout = (Button) findViewById(R.id.bAboutWWF);
    	babout.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				Intent about = new Intent("com.androidwwf.jwr.ABOUTUSACTIVITY");
				startActivity(about);
			}
		});
    	
		bPlayerData = (Button) findViewById(R.id.bUserProfile);
		bPlayerData.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				Intent playerData = new Intent("com.androidwwf.jwr.PLAYERDATAACTIVITY");
				startActivity(playerData);
			}
		});
		
		bBrowser = (Button) findViewById(R.id.bTips);
		bBrowser.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				Intent tips = new Intent("com.androidwwf.jwr.WIDGETBROWSERACTIVITY");
				startActivity(tips);
			}
		});
    }
}